*** TABLE D1 

clear 
use "$P_Data_Processed/monthly_station_data_e5_merged.dta"

** brand level balancing 

gegen brand_pop_density = mean(pop_density), by(Brand year_month)
label variable brand_pop_density "Mean Population Density"
gegen brand_l_pop = mean(l_pop), by(Brand year_month)
label variable brand_l_pop "Mean ln(Population)"
gegen brand_med_age = mean(med_age), by(Brand year_month)
label variable brand_med_age "Mean Median Age"
gegen brand_employed_share = mean(employed_share), by(Brand year_month)
label variable brand_employed_share "Mean Employed Share"
gegen brand_postal_n_stations = mean(postal_n_stations), by(Brand year_month)
label variable brand_postal_n_stations "Mean N Competitors in ZIP"
gegen brand_l_gdp = mean(l_gdp), by(Brand year_month)
label variable brand_l_gdp "Mean ln(region GDP)"
capture drop n_adopters 
gegen n_adopters = total(treat), by(Brand year_month)

by Brand year_month, sort: keep if _n==1

gener share_adopters = n_adopters/n_brand

label variable n_brand "N Brand Stations"

reg share_adopters brand_pop_density brand_l_pop brand_med_age brand_employed_share brand_l_gdp brand_postal_n_stations n_brand i.year_month if n_brand>2, cluster(Brand)

outreg2 using "$P_Tables/Table_D1", replace tex(frag)  dec(5) label keep(brand_pop_density brand_l_pop brand_med_age brand_employed_share brand_l_gdp brand_postal_n_stations n_brand)
